package com.UI
{
	import com.*;
	import com.Home.*;
	import com.Engine.*;
	import com.Packet.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.external.*;
	import flash.filters.*;
	import flash.geom.*;
	import flash.system.*;
	import flash.text.*;
	import flash.ui.*;
	import flash.utils.*;
	
	import org.aswing.*;
	import org.aswing.border.*;
	import org.aswing.border.EmptyBorder;
	import org.aswing.colorchooser.*;
	import org.aswing.dnd.*;
	import org.aswing.event.*;
	import org.aswing.ext.*;
	import org.aswing.geom.*;
	import org.aswing.tree.AbstractLayoutCache;
	
	public class FrameChar extends JFrame
	{
		//members define
		private var panelTop:JPanel;
		private var panel185:JPanel;
		private var btn_tab_char:JToggleButton;
		private var btn_tab_skill:JToggleButton;
		private var btn_tab_title:JToggleButton;
		private var panelRight:JPanel;
		
		
		//-----------------------------------
		private var btn_close:JButton;
		private var panelRightChar:PanelCharChar;
		private var panelRightSkill:PanelCharSkill;
		private var panelRightTitle:PanelCharTitle;
		//private var background:String;
		
		//
		public function FrameChar()
		{
			//component creation
			super();
			setResizable(false);
			setBackgroundDecorator(null);
			setBorder(new EmptyBorder());
			
			//component creation
			setSize(new IntDimension(278, 399));
			setPreferredSize(new IntDimension(278, 399));
			var layout0:SoftBoxLayout = new SoftBoxLayout();
			layout0.setAxis(AsWingConstants.VERTICAL);
			layout0.setAlign(AsWingConstants.LEFT);
			layout0.setGap(0);
			getContentPane().setLayout(layout0);
			
			panelTop = new JPanel();
			panelTop.setLocation(new IntPoint(0, 0));
			panelTop.setSize(new IntDimension(278, 33));
			panelTop.setPreferredSize(new IntDimension(278, 33));
			var layout1:FlowWrapLayout = new FlowWrapLayout();
			layout1.setPreferWidth(200);
			layout1.setAlignment(AsWingConstants.LEFT);
			layout1.setHgap(20);
			layout1.setVgap(4);
			panelTop.setLayout(layout1);
			
			panel185 = new JPanel();
			panel185.setLocation(new IntPoint(19, 5));
			panel185.setSize(new IntDimension(180, 25));
			panel185.setPreferredSize(new IntDimension(180, 25));
			var layout2:SoftBoxLayout = new SoftBoxLayout();
			layout2.setAxis(AsWingConstants.HORIZONTAL);
			layout2.setAlign(AsWingConstants.LEFT);
			layout2.setGap(3);
			panel185.setLayout(layout2);
			
			btn_tab_char = new JToggleButton();
			btn_tab_char.setLocation(new IntPoint(5, 5));
			btn_tab_char.setSize(new IntDimension(58, 25));
			btn_tab_char.setPreferredSize(new IntDimension(58, 25));
			btn_tab_char.setText("label");
			
			btn_tab_skill = new JToggleButton();
			btn_tab_skill.setLocation(new IntPoint(5, 32));
			btn_tab_skill.setSize(new IntDimension(58, 25));
			btn_tab_skill.setPreferredSize(new IntDimension(58, 25));
			btn_tab_skill.setText("label");
			
			btn_tab_title = new JToggleButton();
			btn_tab_title.setLocation(new IntPoint(122, 0));
			btn_tab_title.setSize(new IntDimension(58, 25));
			btn_tab_title.setPreferredSize(new IntDimension(58, 25));
			btn_tab_title.setText("label");
			
			panelRight = new JPanel();
			panelRight.setLocation(new IntPoint(20, 5));
			panelRight.setSize(new IntDimension(278, 359));
			panelRight.setPreferredSize(new IntDimension(278, 359));
			var layout3:SoftBoxLayout = new SoftBoxLayout();
			layout3.setAxis(AsWingConstants.VERTICAL);
			panelRight.setLayout(layout3);
			
			//component layoution
			//getContentPane().append(panelTop);
			//getContentPane().append(panelRight);
			
			panelTop.append(panel185);
			
			panel185.append(btn_tab_char);
			panel185.append(btn_tab_skill);
			panel185.append(btn_tab_title);
			
			
			//--------------------------------------------------------------------------
			btn_tab_char.addActionListener(onTabChar);
			btn_tab_skill.addActionListener(onTabSkill);
			btn_tab_title.addActionListener(onTabTitle);
			

			
			btn_close = new JButton();
			btn_close.setLocation(new IntPoint(198, -5));
			btn_close.setSize(new IntDimension(27, 27));
			btn_close.setPreferredSize(new IntDimension(27, 27));
			getTitleBar().setCloseButton(btn_close);
			getTitleBar().setMinimizeHeight(32);
			
			panelRightChar = new PanelCharChar();
			panelRightChar.setLocation(new IntPoint(0, 0));
			panelRightChar.setSize(new IntDimension(278, 359));
			panelRightChar.setPreferredSize(new IntDimension(278, 359));
			
			panelRightSkill = new PanelCharSkill();
			panelRightSkill.setLocation(new IntPoint(0, 0));
			panelRightSkill.setSize(new IntDimension(278, 359));
			panelRightSkill.setPreferredSize(new IntDimension(278, 359));
			
			panelRightTitle = new PanelCharTitle();
			panelRightTitle.setLocation(new IntPoint(0, 0));
			panelRightTitle.setSize(new IntDimension(278, 359));
			panelRightTitle.setPreferredSize(new IntDimension(278, 359));
			
			panelRight = panelRightChar;
			
			//component layoution
			getContentPane().append(panelTop);
			getContentPane().append(panelRight);
			
			setImages();
		}
		public function setImages():void
		{
			img_char_char_bg = new AssetBackground(Client.getUIElement("img_char_char_bg") as DisplayObject);
			img_char_skill_bg = new AssetBackground(Client.getUIElement("img_char_skill_bg") as DisplayObject);
			img_char_title_bg = new AssetBackground(Client.getUIElement("img_char_title_bg") as DisplayObject);
			
			//background = "img_char_char_bg";
			var img_char_background:DisplayObject = img_char_char_bg.getDisplay(null);
			setBackgroundDecorator(img_char_char_bg);
			//trace("img_char_background.width:"+img_char_background.width+"img_char_background.height:"+img_char_background.height)
			setSizeWH(img_char_background.width,img_char_background.height);
			setLocationXY((Engine.W - width)/2,(Engine.H - height)/2);
			//setLocationXY((Engine.W - img_char_background.width) / 2,(Engine.H - img_char_background.height)/2);
			//trace("img_char_background:",img_char_background.width,img_char_background.height)
			btn_tab_char.setSelected(true);
			
			btn_tab_char.setText("");
			btn_tab_skill.setText("");
			btn_tab_title.setText("");
			btn_tab_char.wrapSimpleButton(Client.getUIElement("btn_tab_char") as SimpleButton);
			btn_tab_skill.wrapSimpleButton(Client.getUIElement("btn_tab_skill") as SimpleButton);
			btn_tab_title.wrapSimpleButton(Client.getUIElement("btn_tab_title") as SimpleButton);

			var group:ButtonGroup = new ButtonGroup();
			group.appendAll(btn_tab_char,btn_tab_skill,btn_tab_title);
			
			btn_close.wrapSimpleButton(Client.getUIElement("btn_close") as SimpleButton);
			
			//var filter:GlowFilter;
			//var font:ASFont = new ASFont("宋体", 14, true, false, false, false);
			//filter = new GlowFilter(0x000000, 1, 2, 2, 10);
			//labelLevel.setFont(font);
			//labelLevel.setForeground(ASColor.WHITE);
			//labelLevel.setTextFilters(new Array(filter));
			getContentPane().setClipMasked(false);
			setClipMasked(false);
			onUpdateData();
		}

		public function onUpdateData():void
		{
			if(panelRight == panelRightChar)
			{
				panelRightChar.setData();
			}
			if(panelRight == panelRightSkill)
			{
				panelRightSkill.setData();
			}
			
			if(panelRight == panelRightTitle)
			{
				panelRightTitle.setData();
			}
		}
		private var img_char_char_bg:AssetBackground = null;
		private var img_char_skill_bg:AssetBackground = null;
		private var img_char_title_bg:AssetBackground = null;
		private function onTabChar(e:Event):void
		{
			if(getBackgroundDecorator() != img_char_char_bg)
				setBackgroundDecorator(img_char_char_bg);
			if(panelRight != panelRightChar)
			{
				getContentPane().remove(panelRight);
				panelRight = panelRightChar;
				getContentPane().append(panelRight);
			}
			paintImmediately();
		}
		private function onTabSkill(e:Event):void
		{
			if(getBackgroundDecorator() != img_char_skill_bg)
				setBackgroundDecorator(img_char_skill_bg);
			
			if(panelRight != panelRightSkill)
			{
				getContentPane().remove(panelRight);
				panelRight = panelRightSkill;
				getContentPane().append(panelRight);
			}
			paintImmediately();
		}
		private function onTabTitle(e:Event):void
		{
			if(getBackgroundDecorator() != img_char_title_bg)
				setBackgroundDecorator(img_char_title_bg);
			
			if(panelRight != panelRightTitle)
			{
				getContentPane().remove(panelRight);
				panelRight = panelRightTitle;
				getContentPane().append(panelRight);
			}
			paintImmediately();
		}
		
		public static function phTitles_1600(e:PacketEvent):void
		{
			var msg:Array = e.data as Array;
			trace("phTitles_1600", msg);
			var nIndex:uint = 0;
			CharInfo.m_stTitleCurrent.csv_id = msg[nIndex++];
			CharInfo.m_stTitleCurrent.name = msg[nIndex++];
			var nCount:uint = msg[nIndex++];
			var array:Array = CharInfo.m_arTitles;
			array.splice(0,array.length);
			for(var i:int = 0; i < nCount; i++)
			{
				var obj:Object = new Object();
				array[i] = obj;
				obj.index = i;
				obj.csv_id = msg[nIndex++];
				obj.name = msg[nIndex++];
			}
			if(FrameChar.isShowing())
			{
				FrameChar._frame.onUpdateData();
			}
		}
		public static function phCharInfo_5(e:PacketEvent):void
		{
			var msg:Array = e.data as Array;
			trace("phCharInfo_5", msg);
			
			switch(msg[0])
			{
				case 0:
				{
					//openMap();
					break;
				}
				case 1:
				{
					FrameCreate.show();
					return;
				}
				case 2:
				{
					FrameInfo.showMessageDialog("错误","取用户信息,数据库错误,请重新登陆!");
					//createCharacter();
					break;
				}
			}
			
			var nIndex:uint = 1;
			CharInfo.charId = msg[nIndex++];
			CharInfo.m_nRace = msg[nIndex++];
			CharInfo.m_nGender = msg[nIndex++];
			CharInfo.charName = msg[nIndex++];
			CharInfo.ingot = msg[nIndex++];
			CharInfo.money = msg[nIndex++];
			CharInfo.honour = msg[nIndex++];
			CharInfo.wood = msg[nIndex++];
			CharInfo.food = msg[nIndex++];
			CharInfo.m_nLevel = msg[nIndex++];
			CharInfo.value = msg[nIndex++];
			CharInfo.headId = msg[nIndex++];
			CharInfo.m_nImageId = msg[nIndex++];
			CharInfo.mapId = msg[nIndex++];
			CharInfo.mapX = msg[nIndex++];
			CharInfo.mapY = msg[nIndex++];
			
			//
			CharInfo.stamina = msg[nIndex++];
			CharInfo.staminaMax = msg[nIndex++];
			CharInfo.staminaUpdateTime = msg[nIndex++];
			CharInfo.exp = msg[nIndex++];
			CharInfo.expMax = msg[nIndex++];
			//CharInfo.hp = msg[nIndex++];
			
			CharInfo.hpMax = msg[nIndex++];
			CharInfo.m_nNextPointHP = msg[nIndex++];
			CharInfo.m_nNextPointMoneyHP = msg[nIndex++];
			CharInfo.ap = msg[nIndex++];
			CharInfo.m_nNextPointAP = msg[nIndex++];
			CharInfo.m_nNextPointMoneyAP = msg[nIndex++];
			CharInfo.dp = msg[nIndex++];
			CharInfo.m_nNextPointDP = msg[nIndex++];
			CharInfo.m_nNextPointMoneyDP = msg[nIndex++];
			CharInfo.sp = msg[nIndex++];
			CharInfo.m_nNextPointSP = msg[nIndex++];
			CharInfo.m_nNextPointMoneySP = msg[nIndex++];
			CharInfo.pointHP = msg[nIndex++];
			
			CharInfo.pointHP = msg[nIndex++];
			//CharInfo.pointEP = msg[nIndex++];
			CharInfo.pointAP = msg[nIndex++];
			CharInfo.pointDP = msg[nIndex++];
			CharInfo.pointSP = msg[nIndex++];
			
			CharInfo.resistHY = msg[nIndex++];
			CharInfo.resistZS = msg[nIndex++];
			CharInfo.resistJD = msg[nIndex++];
			
			CharInfo.m_nPropBJ = msg[nIndex++];
			CharInfo.m_nPropSB = msg[nIndex++];
			CharInfo.m_nPropFJ = msg[nIndex++];
			CharInfo.m_nPropLJ = msg[nIndex++];
			CharInfo.m_nBattlePartnerType = msg[nIndex++];
			//
			/*CharInfo.m_strRealName = msg[nIndex++];
			CharInfo.m_nArchiveGender = msg[nIndex++];
			CharInfo.m_strBirthday = msg[nIndex++];
			CharInfo.m_nHeight = msg[nIndex++];
			CharInfo.m_strIncome = msg[nIndex++];
			
			CharInfo.m_strCareer = msg[nIndex++];
			CharInfo.m_strNativeProvince = msg[nIndex++];
			CharInfo.m_strNativeCity = msg[nIndex++];
			CharInfo.m_strNativeAdded = msg[nIndex++];
			CharInfo.m_strAddressProvince = msg[nIndex++];
			
			CharInfo.m_strAddressCity = msg[nIndex++];
			CharInfo.m_strAddressAdded = msg[nIndex++];
			CharInfo.m_strSelfIntroduction = msg[nIndex++];
			CharInfo.m_strFigureURL = msg[nIndex++];*/
			//
			/*Engine.province != null
			if((Engine.province != null && Engine.province.length != 0)
			|| (Engine.city != null && Engine.city.length != 0)
			|| (Engine.nickname != null && Engine.nickname.length != 0)
			|| (Engine.figureurl != null && Engine.figureurl.length != 0))
			{
			if(CharInfo.m_strRealName != Engine.nickname || CharInfo.m_strNativeProvince != Engine.province || CharInfo.m_strNativeCity != Engine.city || CharInfo.m_strFigureURL != Engine.figureurl)
			{
			CharInfo.m_strRealName = Engine.nickname;
			CharInfo.m_strNativeProvince = Engine.province;
			CharInfo.m_strNativeCity = Engine.city;
			CharInfo.m_strFigureURL = Engine.figureurl;
			Client.getInstance().sendPacketLogic(11,[CharInfo.charId,CharInfo.m_strRealName,CharInfo.m_nArchiveGender,CharInfo.m_strBirthday
			,CharInfo.m_nHeight,CharInfo.m_strIncome,CharInfo.m_strCareer,CharInfo.m_strNativeProvince,CharInfo.m_strNativeCity,CharInfo.m_strNativeAdded
			,CharInfo.m_strAddressProvince,CharInfo.m_strAddressCity,CharInfo.m_strAddressAdded,CharInfo.m_strSelfIntroduction,CharInfo.m_strFigureURL]);
			}
			}*/
			if(FrameBag.isShowing())
				FrameBag._frame.setData();
			//_panelMainHelp.labelCharName.setText(CharInfo.charName);
			PanelMainHelp.getInstance().onCharInfoUpdate();
			//FrameTeam.onTeamUpdate();
			if(_timeStaminaUpdate == null)
			{
				_timeStaminaUpdate = new Timer(1000);
				_timeStaminaUpdate.addEventListener(TimerEvent.TIMER,function():void
				{
					CharInfo.staminaUpdateTime++;
					if(CharInfo.staminaUpdateTime >= 5*60)
					{
						CharInfo.staminaUpdateTime = 0;
						Client.getInstance().sendPacketLogic(504,[0]);
					}
					FrameAddStamina.update();
					
				});
				_timeStaminaUpdate.start();
			}
		}
		
		static private var _timeStaminaUpdate:Timer = null;
		public static function phUpdateCharInfo_500(e:PacketEvent):void
		{
			var msg:Array = e.data as Array;
			trace("phUpdateCharInfo_500", msg);
			
			var nIndex:uint = 0;
			CharInfo.charId = msg[nIndex++];
			CharInfo.ingot = msg[nIndex++];
			CharInfo.money = msg[nIndex++];
			CharInfo.honour = msg[nIndex++];
			CharInfo.wood = msg[nIndex++];
			CharInfo.food = msg[nIndex++];
			CharInfo.m_nLevel = msg[nIndex++];
			CharInfo.value = msg[nIndex++];
			CharInfo.headId = msg[nIndex++];
			CharInfo.m_nImageId = msg[nIndex++];
			
			//
			CharInfo.stamina = msg[nIndex++];
			CharInfo.staminaMax = msg[nIndex++];
			CharInfo.staminaUpdateTime = msg[nIndex++];
			CharInfo.exp = msg[nIndex++];
			CharInfo.expMax = msg[nIndex++];
			//CharInfo.hp = msg[nIndex++];
			
			/*m_nNextPointHP = 0;
			m_nNextPointMoneyHP = 0;
			m_nNextPointAP = 0;
			m_nNextPointMoneyAP = 0;
			m_nNextPointDP = 0;
			m_nNextPointMoneyDP = 0;
			m_nNextPointSP = 0;
			m_nNextPointMoneySP = 0;*/
			
			CharInfo.hpMax = msg[nIndex++];
			CharInfo.m_nNextPointHP = msg[nIndex++];
			CharInfo.m_nNextPointMoneyHP = msg[nIndex++];
			CharInfo.ap = msg[nIndex++];
			CharInfo.m_nNextPointAP = msg[nIndex++];
			CharInfo.m_nNextPointMoneyAP = msg[nIndex++];
			CharInfo.dp = msg[nIndex++];
			CharInfo.m_nNextPointDP = msg[nIndex++];
			CharInfo.m_nNextPointMoneyDP = msg[nIndex++];
			CharInfo.sp = msg[nIndex++];
			CharInfo.m_nNextPointSP = msg[nIndex++];
			CharInfo.m_nNextPointMoneySP = msg[nIndex++];
			CharInfo.pointHP = msg[nIndex++];
			
			//CharInfo.pointEP = msg[nIndex++];
			CharInfo.pointAP = msg[nIndex++];
			CharInfo.pointDP = msg[nIndex++];
			CharInfo.pointSP = msg[nIndex++];
			
			CharInfo.resistHY = msg[nIndex++];
			CharInfo.resistZS = msg[nIndex++];
			CharInfo.resistJD = msg[nIndex++];
			
			CharInfo.m_nPropBJ = msg[nIndex++];
			CharInfo.m_nPropSB = msg[nIndex++];
			CharInfo.m_nPropFJ = msg[nIndex++];
			CharInfo.m_nPropLJ = msg[nIndex++];
			
			//
			FrameHomeBuilding4Market.update();
			if(FrameBag.isShowing())
				FrameBag._frame.setData();
			if(FrameChar.isShowing())
			{
				FrameChar._frame.onUpdateData();
			}	
			PanelMainHelp.getInstance().onCharInfoUpdate();
			if(FrameStrengthen.isShowing())
				FrameStrengthen._frame.update();
		}
		
		public static function phSkills_21(e:PacketEvent):void
		{
			var msg:Array = e.data as Array;
			trace("phSkills_21", msg);
			var nIndex:uint = 0;
			var nCount:uint = msg[nIndex++];
			var array:Array = CharInfo.m_arSkills;
			array.splice(0,array.length);
			for(var i:int = 0; i < nCount; i++)
			{
				var obj:Object = new Object();
				array[i] = obj;
				obj.index = i;
				obj.csv_id = msg[nIndex++];
				if(obj.csv_id == 0)
				{
					continue;
				}
				obj.m_nLevel = msg[nIndex++];
				obj.m_nLevelUpMoney = msg[nIndex++];
				obj.m_nTargetCount = msg[nIndex++];
				obj.m_nRoundCount = msg[nIndex++];
				obj.m_nSuccessRate = msg[nIndex++];
				obj.m_nConsumeHPRate = msg[nIndex++];
			}
			for(i = 0; i < Const.DEFAULT_SKILL_SIZE; i++)
				CharInfo.m_arDefaultSkills[i] = msg[nIndex++];
			if(FrameChar.isShowing())
			{
				FrameChar._frame.onUpdateData();
			}	
		}
		//检查是否信息完整
		public static function isArchiveComplete():Boolean
		{
			return true;
			/*var isComplete:Boolean = false;
			while(1)
			{
				if(CharInfo.m_strRealName == null || CharInfo.m_strRealName.length == 0)
				{
					break;
				}
				if(int(CharInfo.m_strBirthday) <= 0 || int(CharInfo.m_strBirthday) >150)
				{
					//PanelMain.showInfoTimeLimit("年龄必须为1-150");
					break;
				}
				if(int(CharInfo.m_nHeight) < 100 || int(CharInfo.m_nHeight) >200)
				{
					//PanelMain.showInfoTimeLimit("身高必须为100-200");
					break;
				}
				if(CharInfo.m_strSelfIntroduction == null || CharInfo.m_strSelfIntroduction.length < 10)
				{
					break;
				}
				isComplete = true;
				break;
			}
			if(!isComplete)
			{
				if(!isShowing())
					show();
				_frame.onTabSkill(null);
				_frame.btn_tab_char.setSelected(false);
				_frame.btn_tab_skill.setSelected(true);
				if(_frame.panelRightArchive.btn_char_modify.isEnabled())
				{
					_frame.panelRightArchive.onBtnCharModify(null);
				}
				PanelMain.showInfoTimeLimit("先完善档案才能执行此操作!");
			}
			return isComplete;*/
		}
		
		public static var _frame:FrameChar = null;
		public static function show():void
		{
			if(isShowing())
			{
				_frame.hide();
				return;
			}
			if(_frame == null)
			{
				_frame = new FrameChar();
				PanelMainHelp.getInstance().addChild(_frame);
			}
			_frame.show();
			PanelMainHelp.getInstance().bringToTop(_frame);
			_frame.onUpdateData();
			
		}
		public static function hide():void
		{
			if(isShowing())_frame.hide();
		}
		public static function isShowing():Boolean
		{
			return(_frame != null&& _frame.isShowing());
		}
	}
}

import com.*;
import com.UI.*;
import com.Engine.*;
import com.Packet.*;

import flash.display.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;

import org.aswing.*;
import org.aswing.border.*;
import org.aswing.border.EmptyBorder;
import org.aswing.colorchooser.*;
import org.aswing.event.*;
import org.aswing.ext.*;
import org.aswing.geom.*;
import org.aswing.dnd.*;
	/**
	 * PanelRightChar
	 */
	class PanelCharChar extends JPanel{
		
		//members define
		private var panelHead:JPanel;
		private var labelName:JLabel;
		private var labelValue:JLabel;
		private var labelLevel:JLabel;
		private var labelTitle:JLabel;
		private var labelFaction:JLabel;
		private var labelHP:JLabel;
		private var btnHPAdd:JButton;
		private var labelAP:JLabel;
		private var btnAPAdd:JButton;
		private var labelDP:JLabel;
		private var btnDPAdd:JButton;
		private var labelSP:JLabel;
		private var btnSPAdd:JButton;
		private var labelResistHL:JLabel;
		private var labelResistBD:JLabel;
		private var labelResistHS:JLabel;
		private var labelPropBJ:JLabel;
		private var labelPropSB:JLabel;
		private var labelPropFJ:JLabel;
		private var labelPropLJ:JLabel;
		
		
		private var _skills:Array = new Array();
		//private var _tooltips:Array = new Array;
		/**
		 * PanelRightChar Constructor
		 */
		public function PanelCharChar(){
			
			//var filter:GlowFilter;
			//var font:ASFont = new ASFont("宋体", 14, false, false, false, false);
			//filter = new GlowFilter(0x000000, 1, 2, 2, 10);
			
			//component creation
			setSize(new IntDimension(278, 359));
			setPreferredSize(new IntDimension(278, 359));
			var layout0:EmptyLayout = new EmptyLayout();
			setLayout(layout0);
			
			panelHead = new JPanel();
			panelHead.setLocation(new IntPoint(13, 65));
			panelHead.setSize(new IntDimension(114, 200));
			panelHead.setPreferredSize(new IntDimension(114, 200));
			panelHead.setBorder(null);
			
			labelName = new JLabel();
			labelName.setLocation(new IntPoint(26, 14));
			labelName.setSize(new IntDimension(89, 16));
			labelName.setPreferredSize(new IntDimension(89, 16));
			labelName.setText("陶陶陶");
			labelName.setHorizontalAlignment(AsWingConstants.CENTER);
			
			labelValue = new JLabel();
			labelValue.setLocation(new IntPoint(26, 37));
			labelValue.setSize(new IntDimension(89, 16));
			labelValue.setPreferredSize(new IntDimension(89, 16));
			labelValue.setText("label");
			
			labelLevel = new JLabel();
			labelLevel.setLocation(new IntPoint(161, 14));
			labelLevel.setSize(new IntDimension(89, 16));
			labelLevel.setPreferredSize(new IntDimension(89, 16));
			labelLevel.setText("label");
			
			labelTitle = new JLabel();
			labelTitle.setLocation(new IntPoint(161, 37));
			labelTitle.setSize(new IntDimension(89, 16));
			labelTitle.setPreferredSize(new IntDimension(89, 16));
			labelTitle.setText("10000");
			labelTitle.setHorizontalAlignment(AsWingConstants.CENTER);
			
			labelFaction = new JLabel();
			labelFaction.setLocation(new IntPoint(161, 60));
			labelFaction.setSize(new IntDimension(89, 16));
			labelFaction.setPreferredSize(new IntDimension(89, 16));
			labelFaction.setText("label");
			
			labelHP = new JLabel();
			labelHP.setLocation(new IntPoint(161, 97));
			labelHP.setSize(new IntDimension(89, 16));
			labelHP.setPreferredSize(new IntDimension(89, 16));
			labelHP.setText("256");
			labelHP.setHorizontalAlignment(AsWingConstants.CENTER);
			
			btnHPAdd = new JButton();
			btnHPAdd.setLocation(new IntPoint(251, 95));
			btnHPAdd.setSize(new IntDimension(20, 20));
			btnHPAdd.setPreferredSize(new IntDimension(20, 20));
			btnHPAdd.setText("+");
			
			labelAP = new JLabel();
			labelAP.setLocation(new IntPoint(161, 120));
			labelAP.setSize(new IntDimension(89, 16));
			labelAP.setPreferredSize(new IntDimension(89, 16));
			labelAP.setText("369");
			labelAP.setHorizontalAlignment(AsWingConstants.CENTER);
			
			btnAPAdd = new JButton();
			btnAPAdd.setLocation(new IntPoint(251, 118));
			btnAPAdd.setSize(new IntDimension(20, 20));
			btnAPAdd.setPreferredSize(new IntDimension(20, 20));
			btnAPAdd.setText("+");
			
			labelDP = new JLabel();
			labelDP.setLocation(new IntPoint(161, 143));
			labelDP.setSize(new IntDimension(89, 16));
			labelDP.setPreferredSize(new IntDimension(89, 16));
			labelDP.setText("label");
			
			btnDPAdd = new JButton();
			btnDPAdd.setLocation(new IntPoint(251, 141));
			btnDPAdd.setSize(new IntDimension(20, 20));
			btnDPAdd.setPreferredSize(new IntDimension(20, 20));
			btnDPAdd.setText("+");
			
			labelSP = new JLabel();
			labelSP.setLocation(new IntPoint(161, 166));
			labelSP.setSize(new IntDimension(89, 16));
			labelSP.setPreferredSize(new IntDimension(89, 16));
			labelSP.setText("1456");
			labelSP.setHorizontalAlignment(AsWingConstants.CENTER);
			
			btnSPAdd = new JButton();
			btnSPAdd.setLocation(new IntPoint(251, 164));
			btnSPAdd.setSize(new IntDimension(20, 20));
			btnSPAdd.setPreferredSize(new IntDimension(20, 20));
			btnSPAdd.setText("+");
			
			labelResistHL = new JLabel();
			labelResistHL.setLocation(new IntPoint(173, 202));
			labelResistHL.setSize(new IntDimension(89, 16));
			labelResistHL.setPreferredSize(new IntDimension(89, 16));
			labelResistHL.setText("123");
			labelResistHL.setHorizontalAlignment(AsWingConstants.CENTER);
			
			labelResistBD = new JLabel();
			labelResistBD.setLocation(new IntPoint(173, 225));
			labelResistBD.setSize(new IntDimension(89, 16));
			labelResistBD.setPreferredSize(new IntDimension(89, 16));
			labelResistBD.setText("123");
			labelResistBD.setHorizontalAlignment(AsWingConstants.CENTER);
			
			labelResistHS = new JLabel();
			labelResistHS.setLocation(new IntPoint(173, 248));
			labelResistHS.setSize(new IntDimension(89, 16));
			labelResistHS.setPreferredSize(new IntDimension(89, 16));
			labelResistHS.setText("123");
			labelResistHS.setHorizontalAlignment(AsWingConstants.CENTER);
			
			labelPropBJ = new JLabel();
			labelPropBJ.setLocation(new IntPoint(55, 295));
			labelPropBJ.setSize(new IntDimension(76, 16));
			labelPropBJ.setPreferredSize(new IntDimension(76, 16));
			labelPropBJ.setText("label");
			
			labelPropSB = new JLabel();
			labelPropSB.setLocation(new IntPoint(176, 295));
			labelPropSB.setSize(new IntDimension(86, 16));
			labelPropSB.setPreferredSize(new IntDimension(86, 16));
			labelPropSB.setText("label");
			
			labelPropFJ = new JLabel();
			labelPropFJ.setLocation(new IntPoint(55, 318));
			labelPropFJ.setSize(new IntDimension(76, 16));
			labelPropFJ.setPreferredSize(new IntDimension(76, 16));
			labelPropFJ.setText("label");
			
			labelPropLJ = new JLabel();
			labelPropLJ.setLocation(new IntPoint(176, 318));
			labelPropLJ.setSize(new IntDimension(86, 16));
			labelPropLJ.setPreferredSize(new IntDimension(86, 16));
			labelPropLJ.setText("label");
			
			//component layoution
			append(panelHead);
			append(labelName);
			append(labelValue);
			append(labelLevel);
			append(labelTitle);
			append(labelFaction);
			append(labelHP);
			append(btnHPAdd);
			append(labelAP);
			append(btnAPAdd);
			append(labelDP);
			append(btnDPAdd);
			append(labelSP);
			append(btnSPAdd);
			append(labelResistHL);
			append(labelResistBD);
			append(labelResistHS);
			append(labelPropBJ);
			append(labelPropSB);
			append(labelPropFJ);
			append(labelPropLJ);
			
			setImages();
			setData();
			
		}
		
		public function setImages():void
		{
			setClipMasked(false);
			panelHead.setClipMasked(false);
			btnHPAdd.addActionListener(onBtnHPAdd);
			btnAPAdd.addActionListener(onBtnAPAdd);
			btnDPAdd.addActionListener(onBtnDPAdd);
			btnSPAdd.addActionListener(onBtnSPAdd);
			btnHPAdd.setText("");
			btnAPAdd.setText("");
			btnDPAdd.setText("");
			btnSPAdd.setText("");
			
			btnHPAdd.wrapSimpleButton(Client.getUIElement("btn_char_add") as SimpleButton);
			btnAPAdd.wrapSimpleButton(Client.getUIElement("btn_char_add") as SimpleButton);
			btnDPAdd.wrapSimpleButton(Client.getUIElement("btn_char_add") as SimpleButton);
			btnSPAdd.wrapSimpleButton(Client.getUIElement("btn_char_add") as SimpleButton);
			btnHPAdd.setToolTipText("强化生命");
			btnAPAdd.setToolTipText("强化攻击");
			btnDPAdd.setToolTipText("强化防御");
			btnSPAdd.setToolTipText("强化速度");
			
			var filter:GlowFilter;
			var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
			filter = new GlowFilter(0x000000, 1, 2, 2, 10);
			labelName.setFont(new ASFont("宋体", 13, false, false, false, false));
			labelName.setForeground(ASColor.WHITE);
			labelName.setTextFilters(new Array(filter));
			labelValue.setFont(new ASFont("宋体", 13, true, false, false, false));
			labelValue.setForeground(ASColor.YELLOW);
			labelValue.setTextFilters(new Array(filter));
			labelLevel.setFont(font);
			labelLevel.setForeground(ASColor.WHITE);
			labelLevel.setTextFilters(new Array(filter));
			labelTitle.setFont(font);
			labelTitle.setForeground(ASColor.WHITE);
			labelTitle.setTextFilters(new Array(filter));
			labelFaction.setFont(font);
			labelFaction.setForeground(ASColor.WHITE);
			labelFaction.setTextFilters(new Array(filter));
			labelDP.setFont(font);
			labelDP.setForeground(ASColor.WHITE);
			labelDP.setTextFilters(new Array(filter));
			labelHP.setFont(font);
			labelHP.setForeground(ASColor.WHITE);
			labelHP.setTextFilters(new Array(filter));
			labelAP.setFont(font);
			labelAP.setForeground(ASColor.WHITE);
			labelAP.setTextFilters(new Array(filter));
			labelPropBJ.setFont(font);
			labelPropBJ.setForeground(ASColor.WHITE);
			labelPropBJ.setTextFilters(new Array(filter));
			labelPropSB.setFont(font);
			labelPropSB.setForeground(ASColor.WHITE);
			labelPropSB.setTextFilters(new Array(filter));
			labelPropFJ.setFont(font);
			labelPropFJ.setForeground(ASColor.WHITE);
			labelPropFJ.setTextFilters(new Array(filter));
			labelPropLJ.setFont(font);
			labelPropLJ.setForeground(ASColor.WHITE);
			labelPropLJ.setTextFilters(new Array(filter));
			//labelEP.setFont(font);
			//labelEP.setForeground(ASColor.WHITE);
			//labelEP.setTextFilters(new Array(filter));
			labelSP.setFont(font);
			labelSP.setForeground(ASColor.WHITE);
			labelSP.setTextFilters(new Array(filter));
			labelResistHL.setFont(font);
			labelResistHL.setForeground(ASColor.WHITE);
			labelResistHL.setTextFilters(new Array(filter));
			labelResistBD.setFont(font);
			labelResistBD.setForeground(ASColor.WHITE);
			labelResistBD.setTextFilters(new Array(filter));
			labelResistHS.setFont(font);
			labelResistHS.setForeground(ASColor.WHITE);
			labelResistHS.setTextFilters(new Array(filter));
			updateCharImage();
		}

		static private var _loaderChar:CharImageLoader = null;
		public function updateCharImage():void
		{
			if(_loaderChar == null)
				_loaderChar = new CharImageLoader;
			var arCharEquips:Array = new Array();
			//if(CharInfo.m_nImageId != 0)
			//{
			//	arCharEquips.push(Engine.assetMapMonsterPath + "npc_"+ CharInfo.m_nImageId + '.swf');
			//}
			//else
			//{
				for each(var item:Object in CharInfo.m_arItemPage[0])
				{
					if(item.csv_id != 0)
					{
						var objItemCSV:Object = Client.getInstance().GetItemCSV(item.csv_id);
						arCharEquips.push(objItemCSV.equip_image_id);
					}
					else
					{
						arCharEquips.push(0);
					}
				}
			//}
			_loaderChar.loadChar(CharInfo.m_nRace,CharInfo.m_nGender,arCharEquips,onCharLoaded);
		}
		private var _mcCharHead:MovieClip = null;
		private function onCharLoaded():void
		{
			var imgSelf:JPanel = panelHead;
			if(_mcCharHead != null && imgSelf.contains(_mcCharHead))
			{
				imgSelf.removeChild(_mcCharHead)
				_mcCharHead = null;
			}
			_mcCharHead = _loaderChar.getImage("mc_object_stand",true);
			if(_mcCharHead == null)
			{
				_loaderChar.clear();
				_loaderChar = null;
				return;
			}

			var mc:MovieClip = _mcCharHead;
			//mc.gotoAndStop(1);
			mc.scaleX = imgSelf.height/mc.height;
			mc.scaleY = imgSelf.height/mc.height;
			mc.x = (imgSelf.width - mc.width)/2;
			if(CharInfo.m_nGender == 0)
				mc.y = Client._headOffsetYBoy*mc.scaleY;
			else
				mc.y = Client._headOffsetYGirl*mc.scaleY;
			imgSelf.setBackgroundDecorator(null);
			imgSelf.addChild(mc);
			//_loaderChar.clear();
			//_loaderChar = null;
			
		}
		
		private function onBtnOK(e:Event):void
		{
			if(PanelMain.getInstance().isInBattle)
			{
				PanelMain.showInfo("在战斗中不能为人物分配点数!");
				return;
			}
			//Client.getInstance().sendPacketLogic(22,[_tmpHPAdd,_tmpEPAdd,_tmpAPAdd,_tmpSPAdd]);
			//CharInfo.points -= _tmpPointsAdd;
			setData();
		}
		private function onBtnHPAdd(e:Event):void
		{
			FrameStrengthen.show(CharInfo.charName,CharInfo.m_nLevel,0);
		}
		private function onBtnAPAdd(e:Event):void
		{
			FrameStrengthen.show(CharInfo.charName,CharInfo.m_nLevel,1);
		}
		private function onBtnDPAdd(e:Event):void
		{
			FrameStrengthen.show(CharInfo.charName,CharInfo.m_nLevel,2);
		}

		private function onBtnSPAdd(e:Event):void
		{
			FrameStrengthen.show(CharInfo.charName,CharInfo.m_nLevel,3);
		}

		
		private function onRollOver(event:MouseEvent):void
		{
			var target:PanelSkill = event.target as PanelSkill;
			if(!(target.getBorder() is EmptyBorder))
				return;
			target.setBorder(new LineBorder(null,ASColor.GREEN));
		}
		
		private function onRollOut(event:MouseEvent):void
		{
			var target:PanelSkill = event.target as PanelSkill;
			target.setBorder(new EmptyBorder());
		}
		
		//是否接受这个被拖入的组件
		private function onDropAppraiser(initiator:JPanel):Boolean
		{
			return true;
		}
		//被接受的组件被拖入时，改变Panel背景色
		private function onDragEnter(e:DragAndDropEvent):void
		{
			var initiator:PanelSkill = e.getDragInitiator() as PanelSkill;
			if(onDropAppraiser(initiator))
			{
				if(e.target is PanelSkill)
				{
					var target:PanelSkill = e.target as PanelSkill;
					target.setBorder(new LineBorder(null,ASColor.GREEN));
				}
			}
		}
		
		//组件被拖出时，恢复原来的背景色
		private function onDragExit(e:DragAndDropEvent):void
		{
			if(e.target is PanelSkill)
			{
				var target:JPanel = e.target as JPanel;
				target.setBorder(new EmptyBorder());
			}
		}
		//组件被释放时，如果是被接受的，那么把它加入此面板
		private function onDragDrop(event:DragAndDropEvent):void
		{
			var initiator:PanelSkill = event.getDragInitiator() as PanelSkill;
			if(event.target is PanelSkill)
			{
				var target:PanelSkill = event.target as PanelSkill;
				target.setBorder(new EmptyBorder());
				if(onDropAppraiser(initiator))
				{
				}
			}
		}
		/**
		 * 监听到dragBtn的ON_DRAG_RECOGNIZED事件，将拖拽事件托管给DragManager。
		 * @param dragInitiator          此例中是指dragBtn。
		 * @param touchedChild    被鼠标拖住的组件，此例中亦是dragBtn。
		 */
		
		//private var _currentIndex:uint = 0;
		private function onDragRecognized( e:DragAndDropEvent):void
		{
			var btn:PanelSkill = e.target as PanelSkill;
			if(btn.icon_id <= 0)
				return;
			DragManager.startDrag(btn,new SourceData("item", btn.getToolTipText()),new DraggingImageSkill(btn)); 
		}
		private function onSkillClickCount(event:ClickCountEvent):void
		{   
			if(event.getCount() >= 2)
			{   
				
			}   	
		} 
		
		
		public function setData():void
		{
			labelName.setForeground(new ASColor(CharInfo.m_nGender == 0?Engine.colorBoy:Engine.colorGirl));
			labelName.setText(CharInfo.charName);
			labelLevel.setText(CharInfo.m_nLevel.toString());
			labelValue.setText('身价:' + CharInfo.value.toString());
			labelHP.setText(CharInfo.hpMax.toString());
			labelHP.setToolTipText("生命:"+ CharInfo.hpMax);
			labelAP.setText(CharInfo.ap.toString());
			labelAP.setToolTipText("攻击:"+ CharInfo.ap);
			labelDP.setText(CharInfo.dp.toString());
			labelDP.setToolTipText("防御:"+ CharInfo.dp);
			labelSP.setText(CharInfo.sp.toString());
			labelSP.setToolTipText("速度:"+ CharInfo.sp);

			labelTitle.setText(CharInfo.m_stTitleCurrent.name);
			labelFaction.setText(CharInfo.m_objFaction.m_szFactionName);
			//if(CharInfo.m_stTitleCurrent != null && CharInfo.m_stTitleCurrent.csv_id != null)
			//{
			//	var objSkillCSV:Object = Client.getInstance().GetTitleCSV(CharInfo.m_stTitleCurrent.csv_id);
			//	if(objSkillCSV != null)
			//		labelTitle.setText(objSkillCSV.name);
			//}
			
			labelResistHL.setText(CharInfo.resistHY.toString());
			labelResistBD.setText(CharInfo.resistZS.toString());
			labelResistHS.setText(CharInfo.resistJD.toString());
			
			
			labelPropBJ.setText( CharInfo.m_nPropBJ.toString());
			labelPropSB.setText( CharInfo.m_nPropSB.toString());
			labelPropFJ.setText( CharInfo.m_nPropFJ.toString());
			labelPropLJ.setText( CharInfo.m_nPropLJ.toString());
			
			btnHPAdd.setEnabled(CharInfo.pointHP < CharInfo.m_nLevel * 6);
			btnAPAdd.setEnabled(CharInfo.pointAP < CharInfo.m_nLevel * 6);
			btnDPAdd.setEnabled(CharInfo.pointDP < CharInfo.m_nLevel * 6);
			btnSPAdd.setEnabled(CharInfo.pointSP < CharInfo.m_nLevel * 6);
			
			revalidate();
		}
		public function clear():void
		{
			for each(var item:PanelSkill in _skills)
			{
				item.clear();
			}
			_skills.splice(0,_skills.length);
			
			//for each(var tooltip:ToolTipSkill in _tooltips)
			//{
			//	tooltip.clear();
			//}
			//_tooltips.splice(0,_tooltips.length);
			
			btnHPAdd.wrapSimpleButton(new SimpleButton);
			btnAPAdd.wrapSimpleButton(new SimpleButton);
			btnDPAdd.wrapSimpleButton(new SimpleButton);
			btnSPAdd.wrapSimpleButton(new SimpleButton);
			setBackgroundDecorator(null);
		}
		
		private function updateIcon(panel:PanelSkill):void
		{ 
			if(panel.icon_id <= 0)
			{
				panel.setBackgroundDecorator(null);
				return;
			}
			panel.setBackgroundDecorator(new AssetBackground(Client.getSkillElement("img_skill_"+panel.icon_id) as DisplayObject));
		}
	}
	
	/**
	 * PanelRightArchive
	 */
	class PanelCharSkill extends JPanel{
		
		//members define
		private var panelButtons:JPanel;
		private var btn_skill_base:JToggleButton;
		private var btn_skill_control:JToggleButton;
		private var btn_skill_attack:JToggleButton;
		private var btn_skill_assist:JToggleButton;
		private var panelItems:JPanel;
		private var panelBCenter:JPanel;
		private var btnPrev:JButton;
		private var labelPage:JLabel;
		private var btnNext:JButton;
		
		/**
		 * PanelRightArchive Constructor
		 */
		public function PanelCharSkill(){
			
			//component creation
			setSize(new IntDimension(278, 359));
			setPreferredSize(new IntDimension(278, 359));
			var layout0:EmptyLayout = new EmptyLayout();
			setLayout(layout0);
			
			panelButtons = new JPanel();
			panelButtons.setLocation(new IntPoint(12, 10));
			panelButtons.setSize(new IntDimension(254, 30));
			panelButtons.setPreferredSize(new IntDimension(254, 30));
			var layout1:FlowWrapLayout = new FlowWrapLayout();
			layout1.setPreferWidth(200);
			layout1.setAlignment(AsWingConstants.CENTER);
			layout1.setHgap(3);
			layout1.setVgap(0);
			panelButtons.setLayout(layout1);
			
			btn_skill_base = new JToggleButton();
			btn_skill_base.setLocation(new IntPoint(5, 5));
			btn_skill_base.setSize(new IntDimension(59, 30));
			btn_skill_base.setPreferredSize(new IntDimension(59, 30));
			btn_skill_base.setText("label");
			
			btn_skill_control = new JToggleButton();
			btn_skill_control.setLocation(new IntPoint(69, 5));
			btn_skill_control.setSize(new IntDimension(59, 30));
			btn_skill_control.setPreferredSize(new IntDimension(59, 30));
			btn_skill_control.setText("label");
			
			btn_skill_attack = new JToggleButton();
			btn_skill_attack.setLocation(new IntPoint(133, 5));
			btn_skill_attack.setSize(new IntDimension(59, 30));
			btn_skill_attack.setPreferredSize(new IntDimension(59, 30));
			btn_skill_attack.setText("label");
			
			btn_skill_assist = new JToggleButton();
			btn_skill_assist.setLocation(new IntPoint(5, 40));
			btn_skill_assist.setSize(new IntDimension(59, 30));
			btn_skill_assist.setPreferredSize(new IntDimension(59, 30));
			btn_skill_assist.setText("label");
			
			panelItems = new JPanel();
			panelItems.setLocation(new IntPoint(0, 74));
			panelItems.setSize(new IntDimension(278, 225));
			panelItems.setPreferredSize(new IntDimension(278, 225));
			var layout2:GridLayout = new GridLayout();
			layout2.setRows(5);
			layout2.setColumns(1);
			layout2.setHgap(0);
			layout2.setVgap(0);
			panelItems.setLayout(layout2);
			
			panelBCenter = new JPanel();
			panelBCenter.setLocation(new IntPoint(87, 305));
			panelBCenter.setSize(new IntDimension(104, 24));
			panelBCenter.setPreferredSize(new IntDimension(104, 24));
			var layout3:FlowWrapLayout = new FlowWrapLayout();
			layout3.setPreferWidth(200);
			layout3.setAlignment(AsWingConstants.CENTER);
			layout3.setHgap(5);
			layout3.setVgap(0);
			layout3.setMargin(false);
			panelBCenter.setLayout(layout3);
			
			btnPrev = new JButton();
			btnPrev.setLocation(new IntPoint(77, 16));
			btnPrev.setSize(new IntDimension(29, 24));
			btnPrev.setPreferredSize(new IntDimension(29, 24));
			btnPrev.setText("label");
			
			labelPage = new JLabel();
			labelPage.setLocation(new IntPoint(121, 20));
			labelPage.setSize(new IntDimension(36, 16));
			labelPage.setPreferredSize(new IntDimension(36, 16));
			labelPage.setText("label");
			
			btnNext = new JButton();
			btnNext.setLocation(new IntPoint(177, 16));
			btnNext.setSize(new IntDimension(29, 24));
			btnNext.setPreferredSize(new IntDimension(29, 24));
			btnNext.setText("label");
			
			//component layoution
			append(panelButtons);
			append(panelItems);
			append(panelBCenter);
			
			panelButtons.append(btn_skill_base);
			panelButtons.append(btn_skill_control);
			panelButtons.append(btn_skill_attack);
			panelButtons.append(btn_skill_assist);
			
			panelBCenter.append(btnPrev);
			panelBCenter.append(labelPage);
			panelBCenter.append(btnNext);
			//---------------------------------------------------
			
			setImages();
		}
		
		private var _mallItems:Array = new Array();
		public function setImages():void
		{

			btnPrev.setText("");
			btnNext.setText("");
			
			btnPrev.wrapSimpleButton(Client.getUIElement("btn_prev") as SimpleButton);
			btnNext.wrapSimpleButton(Client.getUIElement("btn_next") as SimpleButton);
			
			btn_skill_base.setText("");
			btn_skill_base.wrapSimpleButton(Client.getUIElement("btn_skill_base") as SimpleButton);
			btn_skill_control.setText("");
			btn_skill_control.wrapSimpleButton(Client.getUIElement("btn_skill_control") as SimpleButton);
			btn_skill_attack.setText("");
			btn_skill_attack.wrapSimpleButton(Client.getUIElement("btn_skill_attack") as SimpleButton);
			btn_skill_assist.setText("");
			btn_skill_assist.wrapSimpleButton(Client.getUIElement("btn_skill_assist") as SimpleButton);
			
			btn_skill_base.addActionListener(onBtnBase);
			btn_skill_control.addActionListener(onBtnControl);
			btn_skill_attack.addActionListener(onBtnAttack);
			btn_skill_assist.addActionListener(onBtnAssist);
			
			btn_skill_base.setSelected(true);
			var group:ButtonGroup = new ButtonGroup();
			group.appendAll(btn_skill_base,btn_skill_control,btn_skill_attack,btn_skill_assist);
			
			btnPrev.addActionListener(onBtnPrev);
			btnNext.addActionListener(onBtnNext);
			
			var filter:GlowFilter;
			var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
			filter = new GlowFilter(0x000000, 1, 2, 2, 10);
			labelPage.setForeground(ASColor.WHITE);
			labelPage.setFont(font);
			labelPage.setTextFilters(new Array(filter));
			
			for(var i:int = 0; i < _itemsPerPage; i++)
			{
				var item:PaneCharSkillItem = new PaneCharSkillItem;
				panelItems.append(item);
				_mallItems.push(item);
			}
			panelBCenter.setVisible(false);
			updatePage();
		}
		public function setData():void
		{
			updatePage();
		}
		
		public function clear():void
		{
			btnPrev.wrapSimpleButton(new SimpleButton);
			btnNext.wrapSimpleButton(new SimpleButton);
			setBackgroundDecorator(null);
		}
		
		private var _currentPageIndex:int = 0;
		private var _currentPageIndexAll:int = 0;
		private var _itemsPerPage:int = 5;
		public function updatePage():void
		{
			var objects:Array = CharInfo.m_arSkills;
			
			for each(var obj:Object in _mallItems)
			{
				obj.item = null;
			}
			var nIndex:int = 0;
			var nCount:int = 0;
			for each(var item:Object in objects)
			{
				nCount++;
				if(nCount <= _currentPageIndex*_itemsPerPage)
					continue;
				_mallItems[nIndex++].item = item;
				if(nIndex >= _itemsPerPage)
					break;
			}
			
			var nCount1:int = objects.length;
			_currentPageIndexAll = Math.floor((nCount1+_itemsPerPage-1)/_itemsPerPage);
			labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
			btnPrev.setEnabled(_currentPageIndex > 0 &&  _currentPageIndexAll > 1);
			btnNext.setEnabled(_currentPageIndex < _currentPageIndexAll-1 &&  _currentPageIndexAll > 1);
		}
		private function onBtnBase(event:Event):void
		{
			_currentPageIndex = 0;
			updatePage();
		}
		private function onBtnControl(event:Event):void
		{
			_currentPageIndex = 1;
			updatePage();
		}
		private function onBtnAttack(event:Event):void
		{
			_currentPageIndex = 2;
			updatePage();
		}
		private function onBtnAssist(event:Event):void
		{
			_currentPageIndex = 3;
			updatePage();
		}
		
		private function onBtnPrev(event:Event):void
		{
			_currentPageIndex--;
			if(_currentPageIndex < 0)
				_currentPageIndex = 0;
			else
				updatePage();
		}
		private function onBtnNext(event:Event):void
		{
			_currentPageIndex++;
			if(_currentPageIndex > _currentPageIndexAll-1)
				_currentPageIndex = _currentPageIndexAll-1;
			else
				updatePage();
		}
	}

/**
 * MyPaneCharSkillItem
 */
class PaneCharSkillItem extends JPanel{
	
	//members define
	private var panelIcon:PanelSkill;
	private var labelName:JLabel;
	private var labelLevel:JLabel;
	private var labelCount:JLabel;
	private var btn_operation:JButton;
	
	private var objSkillCSV:Object = null;
	//private var skill:PanelSkill = null;
	//private var tooltip:ToolTipSkill = null;
	
	/**
	 * MyPaneCharSkillItem Constructor
	 */
	public function PaneCharSkillItem(){
		//component creation
		setSize(new IntDimension(278, 45));
		setPreferredSize(new IntDimension(278, 45));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		panelIcon = new PanelSkill();
		panelIcon.setLocation(new IntPoint(13, 2));
		panelIcon.setSize(new IntDimension(40, 40));
		panelIcon.setPreferredSize(new IntDimension(40, 40));
		
		labelName = new JLabel();
		labelName.setLocation(new IntPoint(52, 15));
		labelName.setSize(new IntDimension(89, 16));
		labelName.setPreferredSize(new IntDimension(89, 16));
		labelName.setText("label");
		
		labelLevel = new JLabel();
		labelLevel.setLocation(new IntPoint(125, 15));
		labelLevel.setSize(new IntDimension(38, 16));
		labelLevel.setPreferredSize(new IntDimension(38, 16));
		labelLevel.setText("label");
		
		labelCount = new JLabel();
		labelCount.setLocation(new IntPoint(164, 15));
		labelCount.setSize(new IntDimension(38, 16));
		labelCount.setPreferredSize(new IntDimension(38, 16));
		labelCount.setText("label");
		
		btn_operation = new JButton();
		btn_operation.setLocation(new IntPoint(222, 11));
		btn_operation.setSize(new IntDimension(43, 22));
		btn_operation.setPreferredSize(new IntDimension(43, 22));
		btn_operation.setText("label");
		
		//component layoution
		append(panelIcon);
		append(labelName);
		append(labelLevel);
		append(labelCount);
		append(btn_operation);
		
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelName.setFont(font);
		labelName.setForeground(ASColor.WHITE);
		labelName.setTextFilters(new Array(filter));
		
		labelLevel.setFont(font);
		labelLevel.setForeground(ASColor.WHITE);
		labelLevel.setTextFilters(new Array(filter));
		
		labelCount.setFont(font);
		labelCount.setForeground(ASColor.WHITE);
		labelCount.setTextFilters(new Array(filter));
		
		btn_learn = Client.getUIElement("btn_learn") as SimpleButton;
		btn_levelup = Client.getUIElement("btn_levelup") as SimpleButton;
		
		btn_operation.setText("");
		btn_operation.wrapSimpleButton(btn_learn);
		btn_operation.addActionListener(onBtnLearn);
	}
	private var btn_learn:SimpleButton = null;
	private var btn_levelup:SimpleButton = null;
	private var _item:Object = null;
	public function set item(val:Object):void
	{
		_item = val;
		//panelIcon.setBackgroundDecorator(null);
		
		//if(tooltip != null)
		//	tooltip.setTargetComponent(null);
		
		labelName.setText("");
		labelLevel.setText("");
		labelCount.setText("");
		btn_operation.setVisible(false);
		btn_operation.setToolTipText("");	
		/*if(item != null && item.csv_id != 0)
		{
			objSkillCSV = Client.getInstance().GetSkillCSV(item.csv_id);
			panelIcon.icon_id = objSkillCSV.icon_id;
			labelName.setText(objSkillCSV.name);
			labelLevel.setText(item.m_nLevel);
			labelCount.setText(item.m_nLevel);
			if(tooltip == null)
				tooltip = new ToolTipSkill(item);
			else
				tooltip.setItem(item);
			tooltip.setTargetComponent(panelIcon);
			btn_operation.setVisible(true);
		}
		else
		{
			panelIcon.icon_id = 0;
			if(tooltip != null)
				tooltip.setTargetComponent(null);
		}*/
		panelIcon.item = item;
		if(item != null && item.csv_id != 0)
		{
			objSkillCSV = Client.getInstance().GetSkillCSV(item.csv_id);
			//panelIcon.icon_id = objSkillCSV.icon_id;
			labelName.setText(objSkillCSV.name);
			labelLevel.setText(item.m_nLevel);
			labelCount.setText(item.m_nTargetCount);
			btn_operation.wrapSimpleButton(item.m_nLevel == 0 ? btn_learn : btn_levelup);
			//panelIcon.setEnabled(item.m_nLevel != 0);
			btn_operation.setVisible(true);
			btn_operation.setToolTipText((item.m_nLevel == 0?"学习技能需要铜币:":"升级技能需要铜币:")+item.m_nLevelUpMoney);
			//btn_operation.setEnabled(item.m_nLevel<CharInfo.m_nLevel && item.m_nLevelUpMoney <= CharInfo.money);
			btn_operation.setEnabled(true);
		}
		//updateIcon(panelIcon);
	}
	private function onBtnLearn(e:Event):void
	{
		Client.getInstance().sendPacketLogic(24,[int(_item.csv_id)]);
	}
	/*private function updateIcon(panel:PanelSkill):void
	{ 
		if(panel.icon_id <= 0)
		{
			panel.setBackgroundDecorator(null);
			return;
		}
		panel.setBackgroundDecorator(new AssetBackground(Client.getSkillElement("img_skill_"+panel.icon_id) as DisplayObject));
	}*/
	public function get item():Object
	{
		return _item;
	}
	public function clear():void
	{
		setBackgroundDecorator(null);
		panelIcon.setBackgroundDecorator(null);
		item = null;
	}
	
	
}
/**
 * MyPaneCharTitle
 */
class PanelCharTitle extends JPanel{
	
	//members define
	private var panelItems:JPanel;
	private var panelBCenter:JPanel;
	private var btnPrev:JButton;
	private var labelPage:JLabel;
	private var btnNext:JButton;
	
	/**
	 * MyPaneCharTitle Constructor
	 */
	public function PanelCharTitle(){
		//component creation
		setSize(new IntDimension(278, 359));
		setPreferredSize(new IntDimension(278, 359));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		panelItems = new JPanel();
		panelItems.setLocation(new IntPoint(11, 28));
		panelItems.setSize(new IntDimension(256, 264));
		panelItems.setPreferredSize(new IntDimension(256, 264));
		var layout1:GridLayout = new GridLayout();
		layout1.setRows(8);
		layout1.setColumns(1);
		layout1.setHgap(0);
		layout1.setVgap(0);
		panelItems.setLayout(layout1);
		
		panelBCenter = new JPanel();
		panelBCenter.setLocation(new IntPoint(87, 305));
		panelBCenter.setSize(new IntDimension(104, 24));
		panelBCenter.setPreferredSize(new IntDimension(104, 24));
		var layout2:FlowWrapLayout = new FlowWrapLayout();
		layout2.setPreferWidth(200);
		layout2.setAlignment(AsWingConstants.CENTER);
		layout2.setHgap(5);
		layout2.setVgap(0);
		layout2.setMargin(false);
		panelBCenter.setLayout(layout2);
		
		btnPrev = new JButton();
		btnPrev.setLocation(new IntPoint(77, 16));
		btnPrev.setSize(new IntDimension(29, 24));
		btnPrev.setPreferredSize(new IntDimension(29, 24));
		btnPrev.setText("label");
		
		labelPage = new JLabel();
		labelPage.setLocation(new IntPoint(121, 20));
		labelPage.setSize(new IntDimension(36, 16));
		labelPage.setPreferredSize(new IntDimension(36, 16));
		labelPage.setText("label");
		
		btnNext = new JButton();
		btnNext.setLocation(new IntPoint(177, 16));
		btnNext.setSize(new IntDimension(29, 24));
		btnNext.setPreferredSize(new IntDimension(29, 24));
		btnNext.setText("label");
		
		//component layoution
		append(panelItems);
		append(panelBCenter);
		
		panelBCenter.append(btnPrev);
		panelBCenter.append(labelPage);
		panelBCenter.append(btnNext);
		
		setImages();
	}
	
	private var _mallItems:Array = new Array();
	public function setImages():void
	{
		
		btnPrev.setText("");
		btnNext.setText("");
		
		btnPrev.wrapSimpleButton(Client.getUIElement("btn_prev") as SimpleButton);
		btnNext.wrapSimpleButton(Client.getUIElement("btn_next") as SimpleButton);
		
		//btnPrev.addActionListener(onBtnPrev);
		//btnNext.addActionListener(onBtnNext);
		
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelPage.setForeground(ASColor.WHITE);
		labelPage.setFont(font);
		labelPage.setTextFilters(new Array(filter));
		
		for(var i:int = 0; i < _itemsPerPage; i++)
		{
			var item:PaneCharTitleItem = new PaneCharTitleItem;
			panelItems.append(item);
			_mallItems.push(item);
		}
		updatePage();
	}
	public function setData():void
	{
		updatePage();
	}
	//private var _currentPage:int = -1;
	private var _currentPageIndex:int = 0;
	private var _currentPageIndexAll:int = 0;
	private var _itemsPerPage:int = 8;
	public function updatePage():void
	{
		var objects:Array = CharInfo.m_arTitles;
		
		for each(var obj:Object in _mallItems)
		{
			obj.item = null;
		}
		var nIndex:int = 0;
		var nCount:int = 0;
		for each(var item:Object in objects)
		{
			nCount++;
			if(nCount <= _currentPageIndex*_itemsPerPage)
				continue;
			_mallItems[nIndex++].item = item;
			if(nIndex >= _itemsPerPage)
				break;
		}
		
		var nCount1:int = objects.length;
		_currentPageIndexAll = Math.floor((nCount1+_itemsPerPage-1)/_itemsPerPage);
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
		btnPrev.setEnabled(_currentPageIndex > 0 &&  _currentPageIndexAll > 1);
		btnNext.setEnabled(_currentPageIndex < _currentPageIndexAll-1 &&  _currentPageIndexAll > 1);
	}
	
	private function onBtnPrev(event:Event):void
	{
		_currentPageIndex--;
		if(_currentPageIndex < 0)
			_currentPageIndex = 0;
		else
			updatePage();
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
	}
	private function onBtnNext(event:Event):void
	{
		_currentPageIndex++;
		if(_currentPageIndex > _currentPageIndexAll-1)
			_currentPageIndex = _currentPageIndexAll-1;
		else
			updatePage();
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
	}
}

/**
 * MyPaneCharTitleItem
 */
class PaneCharTitleItem extends JPanel{
	
	//members define
	private var labelName:JLabel;
	private var btn_title_hide:JButton;
	private var btn_title_remove:JButton;
	private var btn_title_use:JButton;
	
	/**
	 * MyPaneCharTitleItem Constructor
	 */
	public function PaneCharTitleItem(){
		//component creation
		setSize(new IntDimension(256, 33));
		setPreferredSize(new IntDimension(256, 33));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		labelName = new JLabel();
		labelName.setLocation(new IntPoint(1, 8));
		labelName.setSize(new IntDimension(166, 16));
		labelName.setPreferredSize(new IntDimension(166, 16));
		labelName.setText("label");
		
		btn_title_hide = new JButton();
		btn_title_hide.setLocation(new IntPoint(169, 8));
		btn_title_hide.setSize(new IntDimension(43, 22));
		btn_title_hide.setPreferredSize(new IntDimension(43, 22));
		btn_title_hide.setText("label");
		
		btn_title_remove = new JButton();
		btn_title_remove.setLocation(new IntPoint(213, 8));
		btn_title_remove.setSize(new IntDimension(43, 22));
		btn_title_remove.setPreferredSize(new IntDimension(43, 22));
		btn_title_remove.setText("label");
		
		btn_title_use = new JButton();
		btn_title_use.setLocation(new IntPoint(169, 8));
		btn_title_use.setSize(new IntDimension(43, 22));
		btn_title_use.setPreferredSize(new IntDimension(43, 22));
		btn_title_use.setText("label");
		
		//component layoution
		append(labelName);
		append(btn_title_hide);
		append(btn_title_remove);
		append(btn_title_use);
		
		
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelName.setFont(font);
		labelName.setForeground(ASColor.WHITE);
		labelName.setTextFilters(new Array(filter));
		
		
		
		btn_title_hide.setText("");
		btn_title_hide.wrapSimpleButton(Client.getUIElement("btn_title_hide") as SimpleButton);
		btn_title_hide.addActionListener(onBtnHide);
		
		btn_title_remove.setText("");
		btn_title_remove.wrapSimpleButton(Client.getUIElement("btn_title_remove") as SimpleButton);
		btn_title_remove.addActionListener(onBtnRemove);
		
		btn_title_use.setText("");
		btn_title_use.wrapSimpleButton(Client.getUIElement("btn_title_use") as SimpleButton);
		btn_title_use.addActionListener(onBtnUse);
		
		//btn_title_remove.setEnabled(false);
	}
	
	private var _item:Object = null;
	public function set item(val:Object):void
	{
		_item = val;
		btn_title_use.setVisible(false);
		btn_title_hide.setVisible(false);
		btn_title_remove.setVisible(false);
		labelName.setText("");
		if(_item == null)
			return;
		//var objSkillCSV:Object = Client.getInstance().GetTitleCSV(item.csv_id);
		//if(objSkillCSV == null)
		//	return;
		labelName.setText(_item.name);
		btn_title_use.setVisible(CharInfo.m_stTitleCurrent.csv_id != item.csv_id);
		btn_title_hide.setVisible(CharInfo.m_stTitleCurrent.csv_id == item.csv_id);
		btn_title_remove.setVisible(true);

	}
	private function onBtnUse(e:Event):void
	{
		Client.getInstance().sendPacketLogic(1601,[int(_item.csv_id)]);
	}
	private function onBtnHide(e:Event):void
	{
		Client.getInstance().sendPacketLogic(1602,[int(_item.csv_id)]);
	}
	private function onBtnRemove(e:Event):void
	{
		Client.getInstance().sendPacketLogic(1603,[int(_item.csv_id)]);
	}
	/*private function updateIcon(panel:PanelSkill):void
	{ 
	if(panel.icon_id <= 0)
	{
	panel.setBackgroundDecorator(null);
	return;
	}
	panel.setBackgroundDecorator(new AssetBackground(Client.getSkillElement("img_skill_"+panel.icon_id) as DisplayObject));
	}*/
	public function get item():Object
	{
		return _item;
	}
	public function clear():void
	{
		setBackgroundDecorator(null);
		item = null;
	}
	
	
}
import com.*;
import com.Engine.*;
import com.Packet.*;

import flash.display.*;
import flash.display.BitmapData;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import flash.utils.ByteArray;
import flash.utils.getQualifiedClassName;

import org.aswing.*;
import org.aswing.border.*;
import org.aswing.border.EmptyBorder;
import org.aswing.colorchooser.*;
import org.aswing.dnd.*;
import org.aswing.event.*;
import org.aswing.ext.*;
import org.aswing.geom.*;
import org.aswing.graphics.*;
import org.aswing.tree.AbstractLayoutCache;
//import src.*;


/*class DraggingImageSkill implements DraggingImage
{
	private var initiator:PanelSkill;
	
	public function DraggingImageSkill(dragInitiator : PanelSkill)
	{
		initiator = new PanelSkill();
		initiator.height = dragInitiator.height;
		initiator.width = dragInitiator.width;
		initiator.setLocationXY(0,0);
		initiator.setBackgroundDecorator(new AssetBackground(Client.getSkillElement("img_skill_"+dragInitiator.icon_id) as DisplayObject));
	}
	
	public function getDisplay():DisplayObject
	{
		return initiator;
	}
	

	public function switchToAcceptImage() : void 
	{
		
		var filter:GlowFilter;
		filter = new GlowFilter(0x00ff00, 1, 2, 2, 10);
		initiator.filters = new Array(filter);
	}
	

	public function switchToRejectImage() : void 
	{
		var filter:GlowFilter;
		filter = new GlowFilter(0xff0000, 1, 2, 2, 10);
		initiator.filters = new Array(filter);
	}
	
}

class PanelSkill extends JPanel
{
	public var icon_id:uint = 0;
	public var index:uint = 0;
	public function PanelSkill()
	{
	}
	public function clear():void
	{
		setBackgroundDecorator(null);
	}
}*/